<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:body>
	<ui:composition template="/template/common/commonLayout.xhtml">

		<ui:define name="content">

			<h:panelGrid>
				<p:dataTable id="stations" var="station"
					value="#{stationTableBean.stationTableDataModel}"
					 scrollable="true" scrollHeight="300" style="width: 100%">

					<p:column headerText="Name">  
                   #{station.name}  
                  </p:column>

					<f:facet name="footer">
						<p:commandButton id="addButton" value="Add"
							icon="ui-icon-circle-plus" oncomplete="addStationDialog.show()" />
					</f:facet>
				</p:dataTable>
			</h:panelGrid>
			<p:dialog header="Add station" widgetVar="addStationDialog"
				resizable="false" showEffect="clip" hideEffect="fold">
				<h:panelGrid cellspacing="8">  
			Enter station name: 
			<p:inputText value="#{stationTableBean.name}" />

					<h:panelGrid columns="2" cellspacing="8">
						<p:commandButton value="Add"
							action="#{stationTableBean.addStation()}"
							onclick="addStationDialog.hide()"
							 update="stations growl" />
						<p:commandButton value="Cancel" onclick="addStationDialog.hide()" />
					</h:panelGrid>
				</h:panelGrid>
			</p:dialog>


		</ui:define>



	</ui:composition>

</h:body>
</html>